package com.rookieci.lifegame.game;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.rookieci.lifegame.MyApp;
import com.rookieci.lifegame.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class GameActivity extends AppCompatActivity {
    @BindView(R.id.textView)
    public TextView textView;
    @BindView(R.id.gameView)
    public GameView gameView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game);
        ButterKnife.bind(this);

        MyApp.setBackgroundOfClick(this, textView);
    }

    @OnClick(R.id.textView)
    public void onTextViewClick(View view) {
        if (gameView.isPause()) {
            gameView.resume();
            textView.setText("暂停");
        } else {
            gameView.pause();
            textView.setText("开始");
        }
    }

    @OnClick(R.id.gameView)
    public void onGameViewClick(View view) {
        gameView.addMode();
    }
}
